/*************************************************************************
 * File: text01.c
 * Author: Your Name
 * Created: 2025-07-17 12:03:11
 ************************************************************************/

#include<stdio.h>
#include<string.h>
//int main()

//{
    //文件写入
//FILE*fp=fopen("myfile","w");
//if(fp==NULL){
  //  printf("open fail\n");
    //return 1;
//}
//const char*msg="hello wgx\n";
//int cur=5;
//while(cur--)
//fwrite(msg,strlen(msg),1,fp);
//fclose(fp);
//
//文件读出
//FILE*fp=fopen("myfile","r");
//if(fp==NULL)
//{
  //  printf("open file");
    //return 1;
//}
  //char buf[1024];
    //const char *msg = "hello wgx\n";
   // while(1){
        //注意返回值和参数，此处有坑，仔细查看man手册关于该函数的说明
     //   ssize_t s = fread(buf, 1, sizeof(buf)-1, fp);
       // if(s > 0){
         //   buf[s] = 0;
           // printf("%s", buf);
        //}
        //if(feof(fp)){
          //  break;
        //}
    //}
   // fclose(fp);
   // return 0;
//}
#define ONE 0001
#define TWO 0010
#define THREE 0100

void fun(int flag)
{
    if(flag&ONE)
        printf("flag has ONE\n");
    if(flag&TWO)
        printf("flag has TWO\n");
    if(flag&THREE)
        printf("flag has THREE\n");
}
int main()
{
    fun(1);
    printf("\n");
    fun(TWO);
    printf("\n");
    fun(THREE);
    printf("\n");
    fun(TWO|ONE);
    printf("\n");
    return 0;
}



    
